﻿<?php //Seyret Component v.0.3//
/**
* @package Seyret
* @version 0.3
* @copyright Copyright (C) 2008 Mustafa DINDAR. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Seyret Video Component is a free software.
* See seyrettos.html for license notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$user =& JFactory::getUser();
$userid=$user->id;

echo $this->toolbar;
echo $this->modtoolbar;



?>


<script type="text/javascript">


jQuery(document).ready(function(){

	jQuery.seyrettools.createmultibox("iframe", "joinchannelbutton");

});

</script>	

<div>
	<div class="channelsheader"><?php echo JText::_('Channels');?></div>
	
	<?php 
	if ($userid > 0) {
	?>
<!-- MY CHANNELS *******************************************  START  ***************** -->
	<div class="mychannels">	
	
		<div id="mychannelslist">
			<div id="mychannelsheader">
				<div id="mychannelsheadertitle">
				<?php echo JText::_('My Channels');?>
				</div>

				<?php  
				if (count($this->myChannelList) < $this->registry->getValue( 'permission.administration.createchannellimit') AND $this->registry->getValue( 'permission.administration.cancreatenewchannel')==1 ) { ?>
			
						
					<div id="createnewchannelbutton">
						<a href="index.php?option=com_seyret&view=channel&task=editchannel">
							<?php echo JText::_('Create New Channel');?>
						</a>
					</div>
					
					<div class="channelcounter"><?php echo JText::_('Limit').": ".count($this->myChannelList) ." / ". $this->registry->getValue( 'permission.administration.createchannellimit') ;?></div>
					
			
				<?php 
				} else if ($this->registry->getValue( 'permission.administration.cancreatenewchannel')!=1) {
					//if you want, you can leave a message like "you don't have right to create channels" etc
				} else {
			
				?>
		
					

					<div id="channellimitfull">
						<?php echo JText::_('You have reached your channel creating limit');?>
					</div>
					<div class="channelcounter"><?php echo JText::_('Limit').": ".count($this->myChannelList) ." / ". $this->registry->getValue( 'permission.administration.createchannellimit') ;?></div>
							
				
				<?php
				}
				?>				
			
				<div style="clear:both;"></div>
			</div>
			
			
			<div>
				<?php

					foreach ($this->myChannelList as $mychannel) {
						
					?>	
						<div class="mychannelitem">

							<a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=channel&amp;id=". $mychannel->id); ?>"><img class="mychannelitemimage" src="<?php echo $mychannel->channelimage; ?>" alt="" /></a>
							<div class="mychannelitemtitle">	<a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=channel&amp;id=". $mychannel->id); ?>"><?php echo $mychannel->channeltitle; ?></a></div>
							<div class="channeleditbuttonsmall"><a style="color:#FFFFFF;" href="index.php?option=com_seyret&view=channel&task=editchannel&id=<?php echo $mychannel->id; ?>"><?php echo JText::_('Editc');?></a></div>
							<div style="clear:both;"></div>
							<div class="mychannelitemmemberinf" >
								<div class="actm"><a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=channel&amp;task=memberlist&amp;id=".$mychannel->id); ?>"> <?php echo JText::_('Members');?></a></div>
								<div class="actm"><?php echo JText::_('Active');?> : <?php echo $mychannel->approvedtotal; ?></div>
								<div class="pndm"><?php echo JText::_('Pending');?> : <?php echo $mychannel->pendingtotal; ?></div>
							</div>

					
						
						</div>
						
					<?php
					}
				
				?>
			
			</div>
			
		</div>
	
		
	

		
		
		<div style="clear:both;"></div>
	</div>		
	
	<?php 
	}
	
	
	?>
	

<!-- MY CHANNELS *******************************************  END  ***************** -->

	<div  class="allchannels">
		<?php
		
		 
		
			foreach ($this->allchannels as $channel) {
				if ($channel->id == "1" ) continue;
			
				$theuser =& JFactory::getUser($channel->ownerid);
				
				if ($userid!=$channel->ownerid) {
				?>
				<div class="channelitem">
					<a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=channel&amp;id=". $channel->id); ?>"><img class="channelitemimage" src="<?php echo $channel->channelimage; ?>" alt="" /></a>
					<div class="channelitemtitle"><a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=channel&amp;id=". $channel->id); ?>"><?php echo $channel->channeltitle; ?></a> </div>
					<div class="channelownername"><?php echo $theuser->username; ?></div>
					<?php 
					if ($channel->opentomembership=="1" && strpos($channel->memberslist, "|".$userid."|")===false && $userid!="0") {
					?>
					<div class="channeljoinbuttonsmall"><a href="<?php echo JURI::root(); ?>index2.php?option=com_seyret&amp;view=channel&amp;task=joinchannel&amp;tmpl=component&amp;id=<?php  echo $channel->id; ?>&amp;iframe=true&amp;width=460&amp;height=290" rel="joinchannelbutton nofollow"  class="joinchannelbutton" title="<?php echo JText::_('Join to channel'); ?>"><?php echo JText::_('Join');?></a></div>
								
					<?php		
					
					}
					
					?>
					

				</div>
				
				<?php
				}

			}
		
		?>
	<div style="clear:both;"></div>
	</div>




</div>